import { defineStore } from "pinia";
import { ref } from "vue";

export const useUserStore = defineStore(
  'user',
  () => {
    const userId = ref(0)
    const setUserId = (id) => userId.value = id 

    const user = ref({
      id:'',
      username:'',
      password:''
    })
    const setUser = (u) => user.value = u

    //global search keyword
    const keyword = ref()
    const setKeyword = (k) => keyword.value = k

    return {userId, setUserId, user, setUser, keyword, setKeyword}
  },
  {
    persist: true
  }
)